<?php
namespace Home\Controller;

use Utuo\DistributionShopForeground;
use My\Model\DistributionShopRedPacketModel;

class DisShopRedPakcetController extends DistributionShopForeground {

	public function _init() {
		layout('disshop');
		$this->setModelName('DistributionShop');
		$this->setModelControllerName('DisShop');
		if ( !in_array(ACTION_NAME, array()) ) { // 排除不支持分享跳转的链接
			$this->setSupportRedirect(isset($_REQUEST['debug'])?false:true);
		}
	}
	
	/**
	 * 红包列表
	 */
	public function listAction() {
		$type = I('type', 1, 'intval') or $type = 1;
		$this->setPageTitle(DistributionShopRedPacketModel::$EFFICACYS_NAV[$type]);
		$packetList =  M("DistributionShopRedPacket")->where(array('cid' => $this->cid, 
																'uid' => $this->uid, 
																'efficacy' => $type,
																'endTime' => array('exp', "=0 or endTime>unix_timestamp()"),
															))->select();
		$this->assign('packetList', $packetList);
		$this->display("{$this->modelControllerName}/redPacketList");
	}
	
}
